/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package FarmacieDAL;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "DETALII_RETETA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DetaliiReteta.findAll", query = "SELECT d FROM DetaliiReteta d"),
    @NamedQuery(name = "DetaliiReteta.findByIdDetaliireteta", query = "SELECT d FROM DetaliiReteta d WHERE d.idDetaliireteta = :idDetaliireteta")})
public class DetaliiReteta implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_DETALIIRETETA")
    private Integer idDetaliireteta;
    @JoinColumn(name = "ID_SUSTANTA", referencedColumnName = "ID_SUBSTANTA_ACTIVA")
    @ManyToOne
    private SubstantaActiva idSustanta;
    @JoinColumn(name = "ID_RETETA", referencedColumnName = "ID_RETETA")
    @ManyToOne(optional = false)
    private Reteta idReteta;

    public DetaliiReteta() {
    }

    public DetaliiReteta(Integer idDetaliireteta) {
        this.idDetaliireteta = idDetaliireteta;
    }

    public Integer getIdDetaliireteta() {
        return idDetaliireteta;
    }

    public void setIdDetaliireteta(Integer idDetaliireteta) {
        this.idDetaliireteta = idDetaliireteta;
    }

    public SubstantaActiva getIdSustanta() {
        return idSustanta;
    }

    public void setIdSustanta(SubstantaActiva idSustanta) {
        this.idSustanta = idSustanta;
    }

    public Reteta getIdReteta() {
        return idReteta;
    }

    public void setIdReteta(Reteta idReteta) {
        this.idReteta = idReteta;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDetaliireteta != null ? idDetaliireteta.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetaliiReteta)) {
            return false;
        }
        DetaliiReteta other = (DetaliiReteta) object;
        if ((this.idDetaliireteta == null && other.idDetaliireteta != null) || (this.idDetaliireteta != null && !this.idDetaliireteta.equals(other.idDetaliireteta))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "FarmacieDAL.DetaliiReteta[ idDetaliireteta=" + idDetaliireteta + " ]";
    }
    
}
